﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Qiang.Controls
{
    [Serializable]
    public class LayerEvent
    {

        /// <summary>
        /// 图层添加事件
        /// </summary>
        public event EventHandler<LayerEventArgs> LayerAdded;

        /// <summary>
        /// 图层移除事件
        /// </summary>
        public event EventHandler<LayerEventArgs> LayerRemoved;

        /// <summary>
        /// 图形是否可见改变事件
        /// </summary>
        public event EventHandler LayerVisibleChanged;

        public event EventHandler<ExtentArgs> ZoomToExtent;

        /// <summary>
        /// 图层数据内容改变事件
        /// </summary>
        public event EventHandler DatasetContentChanged;

        /// <summary>
        /// 图层内容改变事件
        /// </summary>
        public event EventHandler LayerContentChanged;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void OnLayerAdded(object sender, LayerEventArgs e)
        {
            if (this.LayerAdded != null)
                this.LayerAdded(sender, e);
        }


        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void OnLayerRemoved(object sender, LayerEventArgs e)
        {
            if (LayerRemoved != null) LayerRemoved(sender, e);
        }

        /// <summary>
        /// 
        /// </summary>
        protected virtual void OnLayerVisibleChanged(object sender,EventArgs e)
        {            
            if (LayerVisibleChanged != null) LayerVisibleChanged(sender, e);
        }

        /// <summary>
        /// 图层内图形发生改变时
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void OnDatasetContentChanged(object sender, EventArgs e)
        {
            if (DatasetContentChanged != null) DatasetContentChanged(sender, e);
        }

        /// <summary>
        /// 图层内容发生改变时发生。如样式的改变
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void OnLayerContentChanged(object sender, EventArgs e)
        {
            if (LayerContentChanged != null) LayerContentChanged(sender, e);
        }


    }
}
